package com.codechen.scaffold.news.constant;

import lombok.Getter;

/**
 * @author : wuweihong
 * @desc : TODO  请填写你的功能描述
 * @date : 2025-06-15
 */

@Getter
public enum NewsStatusEnum {

	DRAFT("draft"),
	PUBLISHED("published"),
	ARCHIVED("archived");

	private String code;

	private NewsStatusEnum(String code) {
		this.code = code;
	}

	/**
	 * 根据code获取枚举
	 */
	public static NewsStatusEnum getByCode(String code) {
		for (NewsStatusEnum value : values()) {
			if (value.code.equals(code)) {
				return value;
			}
		}
		return null;
	}

}
